package cn.nju.cloudcomputing.db;

import lombok.Data;
import org.apache.commons.collections.CollectionUtils;

import java.util.Date;
import java.util.List;

/**
 * @BelongsProject: SparkProject
 * @BelongsPackage: cn.nju.cloudcomputing.db
 * @Author: shadowbynl
 * @CreateTime: 2022-11-13  20:25
 * @Description: TODO
 * @Version: 1.0
 */
public class TestDB {
    public static void main(String[] args) {
//        String sql = "select * from tb_newbee_mall_user";
//        List<User> users = CRUDTemplate.executeQuery(sql, new BeanListHandler<>(User.class));
//        System.out.println(users);
        int offset = 0;
        while (true) {
            String sql = String.format("select * from repo_info limit %d, %d", offset, 10000);
            List<RespInfo> respInfoList = CRUDTemplate.executeQuery(sql, new BeanListHandler<>(RespInfo.class));
            System.out.println(respInfoList.size());
            offset += 10000;
            if (CollectionUtils.isEmpty(respInfoList)) {
                break;
            }
        }

    }
}

@Data
class User {
    long user_id;
    String nick_name;
    String login_name;
    String password_md5;
    String introduce_sign;
    int is_deleted;
    int locked_flag;
    Date create_time;

}